package com.jxw.launcher;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import java.util.List;

/* loaded from: classes.dex */
public class ListViewAdapter extends BaseAdapter {
    private ViewHolder holder;
    private Context mContext;
    private List<AppInfo> mDatas;
    private int visPoi;

    @Override // android.widget.Adapter
    public long getItemId(int i) {
        return i;
    }

    public ListViewAdapter(Context context, List<AppInfo> list) {
        this.mContext = null;
        this.mDatas = list;
        this.mContext = context;
    }

    public void setData(List<AppInfo> list) {
        this.mDatas = list;
        notifyDataSetChanged();
    }

    @Override // android.widget.Adapter
    public int getCount() {
        return this.mDatas.size();
    }

    @Override // android.widget.Adapter
    public Object getItem(int i) {
        return this.mDatas.get(i);
    }

    public void setVisPoi(int i) {
        this.visPoi = i;
        notifyDataSetChanged();
    }

    @Override // android.widget.Adapter
    public View getView(int i, View view, ViewGroup viewGroup) {
        if (view == null) {
            view = LayoutInflater.from(this.mContext).inflate(R.layout.item_app, viewGroup, false);
            this.holder = new ViewHolder();
            this.holder.labelTv = (TextView) view.findViewById(R.id.app_name);
            this.holder.iconIv = (ImageView) view.findViewById(R.id.app_icon);
            view.setTag(this.holder);
        } else {
            this.holder = (ViewHolder) view.getTag();
        }
        AppInfo appInfo = this.mDatas.get(i);
        this.holder.labelTv.setText(appInfo.getAppLabel());
        this.holder.iconIv.setBackground(appInfo.getAppIcon());
        return view;
    }

    /* loaded from: classes.dex */
    private class ViewHolder {
        private ImageView iconIv;
        private TextView labelTv;

        private ViewHolder() {
        }
    }
}
